<%--
	author:
	time:2011-5-11 14:25:16
--%>
<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib uri="TowkerTagLib" prefix="rbac"%>
<%@include file="/commons/include/html_doctype.html"%>
<html>
<head>
	<title>添加</title>
	<%@include file="/commons/include/add.jsp" %>
	<script type="text/javascript">
$(function(){
	
	jQuery("#dataForm").validate(
	{
		rules: {
			account:{
				required: true,
				minlength: 5,
			},
			email:{
				email: true,
			},
			mobile:{
				digits: true,
			},
			name:{
				required: true,
				minlength: 2,
			},
			password:{
				required: true,
				minlength: 5,
			},
		},
		messages: {
			account:{
				required:"请输入登录名！",
				minlength: "登录名至少5个字符！",
			},
			email:{
				email:"请输入电子邮件！",
			},
			mobile:{
				digits: "请输入手机！",
			},
			name:{
				required:"请输入姓名！",
				minlength: "姓名至少2个字符！",
			},
			password:{
				required:"请输入密码！",
				minlength: "密码至少5个字符！",
			},
		}, 
		submitHandler:function(form)
		{
			jQuery(form).ajaxSubmit(_options);
		}
	});
});
validCallBack = function()
{
	//添加页面自定义校验
	if(!isMobile($("#mobile").val()))
	{
		return false;
	}
	if(!isTelephone($("#officephone").val()))
	{
		return false;
	}
	return true;
};
//验证手机号码。
function isMobile(obj)
{
	if(obj.length!=11)
	{
		alert("这个手机号不存在！");
		return false;
	}
	else if(obj.substring(0,2)!="13" && obj.substring(0,2)!="15") 
	{
		alert("这个手机号不存在！");
		return false;
	}
	else if(isNaN(obj)) 
	{
		alert("手机号码不合法！");
		return false;
	}
	return true;
}
//验证电话号码。
function isTelephone(obj)// 正则判断
{ 
	var pattern=/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/; 
	if(pattern.test(obj)) 
	{ 
		return true; 
	} 
	else 
	{ 
		alert("电话号码不合法！");
		return false; 
	} 
} 


</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" class="listLogo">
	<tr>
		<td class="title">用户信息添加</td>
		<td>
			<div class="menuTool">
				<a class="save" id="dataFormSave" href="#">保存</a>
				<a class="back" href="getUser.htm">返回</a>
			</div>
		</td>
	</tr>
</table>
<div class="line"></div>
<form id="dataForm" method="post" action="addUser2.htm">
	<table border="0" cellspacing="1" cellpadding="0" class="listTable">
		<tr>
			<td class="form_title">登录名：</td>
			<td class="form_input">
				<input type="text" id="account" name="account" value="" />
			</td>
		</tr>
		<tr>
			<td class="form_title">密码：</td>
			<td class="form_input">
				<input type="text" id="password" name="password" value="" />
			</td>
		</tr>
		<tr>
			<td class="form_title">姓名：</td>
			<td class="form_input">
				<input type="text" id="name" name="name" value="" />
			</td>
		</tr>
		<tr>
			<td class="form_title">头衔：</td>
			<td class="form_input">
				<input type="text" id="headship" name="headship" value="" />
			</td>
		</tr>
		<tr>
			<td class="form_title">手机：</td>
			<td class="form_input">
				<input type="text" id="mobile" name="mobile" value="" />
			</td>
		</tr>
		<tr>
			<td class="form_title">电话：</td>
			<td class="form_input">
				<input type="text" id="officephone" name="officephone" value="" />
			</td>
		</tr>
		<tr>
			<td class="form_title">电子邮件：</td>
			<td class="form_input">
				<input type="text" id="email" name="email" value="" />
			</td>
		</tr>
	</table>
</form>
</body>
</html>
